package com.unitedvision.service.impl;

import java.util.List;

import javax.annotation.Resource;
import javax.persistence.EntityNotFoundException;

import com.unitedvision.persistence.domain.ModuleEntity;
import com.unitedvision.persistence.repository.ModuleRepository;
import com.unitedvision.service.ModuleService;

public class ModuleServiceImpl implements ModuleService {

	@Resource
	private ModuleRepository moduleRepository;
	
	@Override
	public void save(ModuleEntity module) {
		moduleRepository.save(module);
	}

	@Override
	public void delete(ModuleEntity module) {
		moduleRepository.delete(module);
	}

	@Override
	public ModuleEntity get(int id) throws EntityNotFoundException {
		return moduleRepository.findOne(id);
	}

	@Override
	public ModuleEntity getByName(String name) throws EntityNotFoundException {
		return moduleRepository.findByName(name);
	}

	@Override
	public List<ModuleEntity> getAll() throws EntityNotFoundException {
		return moduleRepository.findAll();
	}

	@Override
	public long count() {
		return moduleRepository.count();
	}

}
